home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / gnat1792.zip / gnat179b / t-adainc / a-direio.ads < prev    next >
Text File  |  1994-05-19  |  4KB  |  102 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --                        A D A . D I R E C T _ I O                         --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.2 $                              --
  10. --                                                                          --
  11. --           Copyright (c) 1992,1993,1994 NYU, All Rights Reserved          --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
  22. --                                                                          --
  23. ------------------------------------------------------------------------------
  24.  
  25.  
  26. with Ada.IO_Exceptions;
  27.  
  28. generic
  29.    type Element_Type is private;
  30.  
  31. package Ada.Direct_IO is
  32.  
  33.    type File_Type is limited private;
  34.  
  35.    type File_Mode is (In_File, Inout_File, Out_File);
  36.    type Count     is range 0 .. Long_Long_Integer'Last;
  37.    subtype Positive_Count is Count range 1 .. Count'Last;
  38.  
  39.    ---------------------
  40.    -- File Management --
  41.    ---------------------
  42.  
  43.    procedure Create (File : in out File_Type;
  44.                      Mode : in File_Mode := Inout_File;
  45.                      Name : in String := "";
  46.                      Form : in String := "");
  47.  
  48.    procedure Open   (File : in out File_Type;
  49.                      Mode : in File_Mode;
  50.                      Name : in String;
  51.                      Form : in String := "");
  52.  
  53.    procedure Close  (File : in out File_Type);
  54.    procedure Delete (File : in out File_Type);
  55.    procedure Reset  (File : in out File_Type; Mode : in File_Mode);
  56.    procedure Reset  (File : in out File_Type);
  57.  
  58.    function Mode    (File : in File_Type) return File_Mode;
  59.    function Name    (File : in File_Type) return String;
  60.    function Form    (File : in File_Type) return String;
  61.  
  62.    function Is_Open (File : in File_Type) return Boolean;
  63.  
  64.    ---------------------------------
  65.    -- Input and Output Operations --
  66.    ---------------------------------
  67.  
  68.    procedure Read
  69.      (File : in File_Type; Item : out Element_Type; From : Positive_Count);
  70.    procedure Read
  71.      (File : in File_Type; Item : out Element_Type);
  72.  
  73.    procedure Write
  74.      (File : in File_Type; Item : in  Element_Type; To : Positive_Count);
  75.    procedure Write
  76.      (File : in File_Type; Item : in Element_Type);
  77.  
  78.    procedure Set_Index (File : in File_Type; To : in Positive_Count);
  79.  
  80.    function Index (File : in File_Type) return Positive_Count;
  81.    function Size  (File : in File_Type) return Count;
  82.  
  83.    function End_Of_File (File : in File_Type) return Boolean;
  84.  
  85.    ----------------
  86.    -- Exceptions --
  87.    ----------------
  88.  
  89.    Status_Error : exception renames IO_Exceptions.Status_Error;
  90.    Mode_Error   : exception renames IO_Exceptions.Mode_Error;
  91.    Name_Error   : exception renames IO_Exceptions.Name_Error;
  92.    Use_Error    : exception renames IO_Exceptions.Use_Error;
  93.    Device_Error : exception renames IO_Exceptions.Device_Error;
  94.    End_Error    : exception renames IO_Exceptions.End_Error;
  95.    Data_Error   : exception renames IO_Exceptions.Data_Error;
  96.  
  97. private
  98.    --  Dummy definition (body not yet implemented) ???
  99.  
  100.    type File_Type is new Integer;
  101. end Ada.Direct_IO;
  102.